import { getOrders } from "@/api/orders.js";
// 状态
const state = {
  ordersData: {},
  ordersTotal: 0,
};
// 修改状态
const mutations = {
  setOrders(state, payload) {
    state.ordersData = payload.goods;
    state.ordersTotal = payload.total;
  },
};
// 执行异步
const actions = {
  async getOrders(context, data) {
    // console.log(data);
    const res = await getOrders(data);
    // console.log(res);
    context.commit("setOrders", res);
  },
};
export default {
  namespaced: true,
  state,
  mutations,
  actions,
};
